package com.bdqn.dao;
import com.bdqn.pojo.Supplier;
import org.mybatis.spring.SqlSessionTemplate;
import java.util.List;
public class SupplierMapperImpl implements SupplierMapper{
    // mybatis-spring包中提供的实现了SqlSession接口的类，用来操作数据库
    private SqlSessionTemplate sqlSession;
    // 查询供应商信息
    @Override
    public List<Supplier> selectSupplier(Supplier supplier) {
        return sqlSession.getMapper(SupplierMapper.class).selectSupplier(supplier);
    }
    // 添加供应商信息
    @Override
    public int add(Supplier supplier) {
        return this.getSqlSession().getMapper(SupplierMapper.class).add(supplier);
    }

    @Override
    public int delete(Integer id) {
        return this.getSqlSession().getMapper(SupplierMapper.class).delete(id);
    }

    @Override
    public int update(Supplier supplier) {
        return this.getSqlSession().getMapper(SupplierMapper.class).update(supplier);
    }


    public SqlSessionTemplate getSqlSession() {
        return sqlSession;
    }

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }
}


